package PracticaClase9;

import java.util.ArrayList;

public class Polinomios {
	double a;
	double b;
	double c;
	
	public Polinomios(double a, double b, double c){
		this.a = a;
		this.b = b;
		this.c = c;
	}
	
	private double obtenerTerminoRaiz(){
		return (Math.pow(this.b, 2))-(4*this.a*this.c);
	}
	
	private ArrayList<Object> obtenerResultado(){
		ArrayList<Object> listX = new ArrayList<Object>();
		listX.add(((-1*this.b)+(Math.sqrt(obtenerTerminoRaiz())))/(2*this.a));
		listX.add(((-1*this.b)-(Math.sqrt(obtenerTerminoRaiz())))/(2*this.a));
		return listX;
	}
	
	public ArrayList<Object> obtenerRaices(){
		if (obtenerTerminoRaiz() >= 0) {
			return obtenerResultado();
		}
		else {
			ArrayList<Object> listResul = new ArrayList<Object>();
			listResul.add("No tiene raices reales");
			return listResul;
		}
	}
}
